<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Obavestenja</title>
        <h:outputStylesheet library="css" name="styles.css"/> 
    </h:head>
    <h:body>
        <ui:include src="profMenuBar.xhtml"/>
        <h:form>
            <p:panel id="obavestenja" header="Izmena" styleClass="headerPanel"> 
                <p:selectOneMenu id="nekidjavo" value="#{profBean.selectedP}" var="p" converter="courseConverter">
                    <f:selectItems value="#{profBean.PList}" var="predmet" itemLabel="#{predmet.naziv} - #{predmet.sifra}" itemValue="#{predmet}"/>
                    <p:ajax event="change" update="obavestenja" listener="#{profBean.postaviO()}"/>
                    <p:column>
                        #{p.naziv} - #{p.sifra}
                    </p:column>
                </p:selectOneMenu><br/><br/>
                <p:selectOneMenu value="#{profBean.selectedO}" var="o" converter="infoConverter">
                    <f:selectItems value="#{profBean.toList(profBean.selectedInfoList)}" var="obavestenje" itemLabel="#{obavestenje.naslov}" itemValue="#{obavestenje}"/>
                    <p:ajax event="change"  update="obavestenja2" />
                    <p:column>
                        #{o.naslov}
                    </p:column>
                </p:selectOneMenu> <br/><br/>
                <p:panel id="obavestenja2">
                    <h:outputLabel value="Naslov obavestenja:"/> <br/> <br/>
                    <p:inputText value="#{profBean.selectedO.naslov}"/> <br/> <br/>

                    <h:outputLabel value="Tekst obavestenja:"/> <br/> <br/>
                    <p:editor value="#{profBean.selectedO.tekst}" width="600"/> <br/> <br/>

                    <h:outputLabel value="Kategorija:"/> <br/><br/>
                    <p:selectOneListbox value="#{profBean.SKategorija}">
                        <f:selectItems value="#{profBean.OKategorija}"/>
                    </p:selectOneListbox> <br/><br/>
                </p:panel>
                <p:commandButton value="Izmeni" action="#{profBean.updateInfo()}" ajax="false" style="margin: auto; margin-left: 100px;"/>
            </p:panel>
        </h:form>
    </h:body>
</html>

